<div class="layui-form" lay-filter="layuiadmin-form-userform" style="padding: 20px 30px 0 0;margin: 0 auto;">


    <div class="layui-form-item">
        <label class="layui-form-label">公司名称</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input value="{{ d.params.companyId || '' }}" id="soso1" style="display: none;" />
                <select name="companyId" id="sosoa" style="background-color: #F5F5F5;">
                    
                </select>
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="userName" value="{{ d.params.userName || '' }}" lay-verify="" placeholder="请输入联系人" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <!-- <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="password" name="password" value="{{ d.params.password || '' }}" lay-verify="" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div> -->


    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="button" lay-submit lay-filter="LAY-user-back-submit" value="确认" class="layui-btn">
        </div>
    </div>
</div>

<style type="text/css">
    .layui-form-label {
        width: 95px;
    }
</style>

<script>
    layui.use(['admin', 'form', 'upload'], function() {
        var $ = layui.$,
            setter = layui.setter,
            form = layui.form,
            admin = layui.admin
        upload = layui.upload;

        admin.req({
            url: setter.request.baseUrl + "company/query",
            data: JSON.stringify({
                pageNum: 1,
                pageSize: 100
            }),
            type: "POST",
            dataType: "json",
            contentType: "application/json;charset=UTF-8",
            done: function(res) {
                console.log(res);
                var html = "<option style='color:#e6e6e6;' value='' selected = 'selected'></option>";
                for (i = 0; i < res.info.length; i++) {
                    if (res.info[i].companyName == null) {

                    } else {
                        html += "<option name='companyName'  value=" + res.info[i].id + "  >" + res.info[i].companyName + "</option>"
                    }
                }


                $("#sosoa").empty().append(html)
                var gongsiname = $("#soso1").val();
                console.log('11111', $("#soso1").val())
                if (gongsiname != "") {
                    $("#sosoa option[value=" + gongsiname + "]").attr("selected", true);
                }
                form.render('select'); //需要渲染一下
            },

        });
    })
</script>